import os
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm3-6b-base", trust_remote_code=True)
model = AutoModel.from_pretrained("THUDM/chatglm3-6b-base", trust_remote_code=True).half()

inputs = tokenizer(["今天天气真不错"], return_tensors="pt")
outputs = model.generate(**inputs,max_new_tokens=1024)
print(tokenizer.decode(outputs[0].tolist()))